﻿//using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Drawing;
//using System.Drawing.Drawing2D;
//using Petra.Gis.Geometry.Support;

//namespace Petra.Gis.Drawing
//{
  
//  /// <summary>
//  /// Forward only linked list of <c>System.Drawing.Point</c> for easy manipulation eg. transformation, rectangle clipping,...
//  /// </summary>
//  public class PointList : IEnumerable<PointListNode>
//  {
    
//    private PointListNode[] _ptArray;
//    private int _numCoords;
//    private int _startPoint;

//    public PointList()
//    {

//    }

//    public PointList(CoordinateList coords, DisplayTransformMatrix transformMatrix)
//    {

//      _numCoords = coords.Count;
//      _ptArray = new PointListNode[_numCoords];

//      PointD tmpPt = new PointD();

//      //foreach returns still same instance of Cordinate, which is faster ;-)
//      int i = 0;
//      foreach (Coordinate c in coords)
//      {
//        tmpPt.X = c.X;
//        tmpPt.Y = c.Y;

//        transformMatrix.transformPoint(tmpPt);

//        _ptArray[i].point.X = (int)tmpPt.X;
//        _ptArray[i].point.Y = (int)tmpPt.Y;
//        _ptArray[i].next = ++i;
//      }

//      _ptArray[_numCoords - 1].next = null;
//      _startPoint = 0;

//    }





//    public IEnumerator<PointListNode> GetEnumerator()
//    {
//      Nullable<int> i = _startPoint;
//      while (i != null)
//      {
//        yield return (_ptArray[(int)i]);
//        i = _ptArray[(int)i].next;
//      }
//    }

//    IEnumerator IEnumerable.GetEnumerator()
//    {
//      return GetEnumerator();
//    }





//    public PointListNode this[int index]
//    {
//      get
//      {
//        if (index < 0 || index > (_numCoords - 1))
//          throw new IndexOutOfRangeException("index out of range");

//        Nullable<int> i = _startPoint;
//        for (int j = 0; i != null && j < index; j++)
//          i = _ptArray[index].next;

//        return _ptArray[(int)i];
//      } 
//    }





//    /// <summary>
//    /// before use with windows GDI, WPF, must call this to get pure Point[]
//    /// </summary>
//    /// <param name="outType">supports only System.Drawing.Point, ...</param>
//    /// <returns>array of Point[] of given type</returns>
//    public object ToArray(System.Type outType)
//    {

//      Point[] tmpPts = new Point[_numCoords];

//      int j = _startPoint;
//      for (int i = 0; i < _numCoords; i++)
//      {
//        tmpPts[i] = _ptArray[j].point;
//        j = (int)_ptArray[j].next;
//      }

//      return tmpPts;
//    }

//  }
  
//}
